<table class="table table-responsive" id="goods-table">
    <thead>
        <th>图片</th>
        <th>条码</th>
        <th>名称</th>
        <th>备注</th>
        <th>库存</th>
        <th>售价</th>
        <th>库存平均价</th>
        <th>利率</th>
        <th>优惠</th>
        <th colspan="3">Action</th>
    </thead>
    <tbody>
    @foreach($goods as $goods)
        <tr>
            <td><img src="{!! $goods->image !!}" style="width: 70px" alt=""></td>
            <td>{!! $goods->sn !!}</td>
            <td>{!! $goods->name !!}</td>
            <td>{!! $goods->remark !!}</td>
            <td>{!! $goods->number !!}</td>
            <td>{!! $goods->price !!}</td>
            <td>{!! $goods->average_price !!}</td>
            <td>{!! $goods->rate !!}</td>
            <td>{!! $goods->discounts !!}</td>
            <td>
                {!! Form::open(['route' => ['goods.destroy', $goods->id], 'method' => 'delete']) !!}
                <div class='btn-group'>
                    <a href="#" class='btn btn-default btn-xs' data-toggle="modal" data-target="#myModal" onclick="reply({{$goods->id}},)">进货</a>
                    <a href="{!! route('goods.show', [$goods->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>
                    <a href="{!! route('goods.edit', [$goods->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-edit"></i></a>
                    {!! Form::button('<i class="glyphicon glyphicon-trash"></i>', ['type' => 'submit', 'class' => 'btn btn-danger btn-xs', 'onclick' => "return confirm('Are you sure?')"]) !!}
                </div>
                {!! Form::close() !!}
            </td>
        </tr>
    @endforeach
    </tbody>
</table>



@section('scripts')
    <script>
        function reply(id) {
            $('#goods_id').val(id);
        };
    </script>
@endsection



@section('below_body')
    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">进货</h4>
                </div>

                {!! Form::open(['route' => 'goods.stock','method'=>'post']) !!}
                <input type="hidden" name="goods_id" id="goods_id" value="">
                <div class="modal-body">
                    数量：<input name="number" id="number">
                    价格：<input name="money" id="money">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="submit" class="btn btn-primary">添加</button>
                </div>
                {!! Form::close() !!}
            </div>
        </div>
    </div>
@endsection